package project.controller;

import project.entity.Grade;
import project.service.GradeService;
import project.service.impl.GradeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/*
杨威
2021/9/16
11:59
*/
@WebServlet("/gradeController")
public class GradeController extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        GradeService gradeService=new GradeServiceImpl();
        List<Grade> grades = gradeService.selectAllGrade();
        request.setAttribute("grades",grades);
        request.getRequestDispatcher("/insert.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
